package com.yzc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yzc.pojo.MenuBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author 22875
 * @description 针对表【t_menu】的数据库操作Mapper
 * @createDate 2024-05-09 15:01:59
 * @Entity com.yzc.pojo.MenuBean
 */
@Mapper
public interface MenuBeanMapper extends BaseMapper<MenuBean> {

    @Select("select * from t_menu  where state=0")
    List<MenuBean> loadMenuDateInfo();



    @Select("SELECT * FROM t_menu WHERE state = 0 and id != 1 and name LIKE concat('%',#{name},'%')")
    List<MenuBean> selectInfosByWhere(String name);

    List<MenuBean> loadMenuTree();

//    @Select("select a.*, #{userid} as userid from t_menu as a where a.parentid=0")
    List<MenuBean> loadMenuTreeByUserid(int userid);


    void updateInfo(MenuBean menuBean);

    @Select("select * from t_menu  where state=0 and id = #{id}")
    List<MenuBean> loadMenuDateById(int id);

    @Update("update t_role_menu set state=1 where menuid = #{id}")
    void deleteInfo(Integer id);
}




